//
//  ZFK_scrollPic_CollectionViewCell.m
//  Drops
//
//  Created by SHG on 16/5/20.
//  Copyright © 2016年 Drops.er. All rights reserved.
//

#import "ZFK_scrollPic_CollectionViewCell.h"

@implementation ZFK_scrollPic_CollectionViewCell

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.imageView.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:self.imageView];
    
    self.layerView = [[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT - HEIGHT / 2.2, WIDTH, HEIGHT / 2.2)];
    self.layerView.alpha = 0.5;
    self.gradientLayer = [CAGradientLayer layer];
    self.gradientLayer.bounds = self.layerView.bounds;
    self.gradientLayer.borderWidth = 0;
    
    self.gradientLayer.frame = self.layerView.bounds;
    self.gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor clearColor] CGColor], (id)[[UIColor blackColor] CGColor], nil];
    self.gradientLayer.startPoint = CGPointMake(0.5, 0.5);
    self.gradientLayer.endPoint = CGPointMake(0.5, 1.0);
    
    [self.layerView.layer insertSublayer:self.gradientLayer atIndex:0];
    
    [self.imageView addSubview:self.layerView];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, HEIGHT - HEIGHT / 4.5, WIDTH - 20, HEIGHT / 7)];
    self.titleLabel.backgroundColor = [UIColor clearColor];
    self.titleLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.titleLabel];
}

@end
